<?php

namespace Core;

class Urclass {

    protected static $instances;

    public function __construct($class = null) {
        if(!is_null($class)) {
            $this->instantiate(get_called_class());
        }
    }

    protected function instantiate($class) {
        self::$instances[$class][] = &$this;
    }

    public static function getInstances() {
        return self::$instances;
    }

    public static function getClassInstances() {
        return self::$instances[get_called_class()];
    }
}